package com.doctorliang.cheng.shopping.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by CHENG on 2017/9/30.
 * 缓存工具类
 */

public class CacheUtils {
    /**
     * 获取保存的String类型数据
     * @param mcontext
     * @param key
     * @return
     */
    public static String getString(Context mcontext, String key) {
        SharedPreferences sp = mcontext.getSharedPreferences("doctorliang",Context.MODE_PRIVATE);
        return sp.getString(key,"");

    }
    /**
     * 保存String类型数据
     * @param mcontext
     * @param key
     * @return
     */
    public static void setString(Context mcontext, String key,String values) {
        SharedPreferences sp = mcontext.getSharedPreferences("doctorliang",Context.MODE_PRIVATE);
        sp.edit().putString(key,values).commit();

    }
}
